<?php

namespace app\api\controller;

use app\admin\model\Deviceslot;
use app\common\controller\Api;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $orderNo = getOrderNo();
        $this->success('请求成功',$orderNo);
    }


    public function jia()
    {

        $key = "AES0324HGLC5D030";
        $str = '{"userId":"17612341234","shopId":"1","deviceId":"2001","captcha":"789965"}';
        $result =  base64_encode(openssl_encrypt($str, 'AES-128-ECB', $key, OPENSSL_RAW_DATA));

        $this->success('',$result);
    }

    public function jie ()
    {

        $key = "AES0324HGLC5D030";



        $input = "XgQQAaYU2kVUNVmb7Up930msse6/S0yVvhMT/TIGoZ1+DIs9/+5flC/ZcLMD/bbehdSXAHBpswDLomMn5qPuXW//Z44wi+/RRoxgV2XjmnuvW+MsLOqr95zsY1PHTC8m";
      $result = openssl_decrypt(base64_decode($input), 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
      $result = json_decode($result,true);
      $this->success('',$result);
    }

    public function addSlot()
    {

        $token = urlencode("l1k19rnb6irxr/PifipDta6sGicTj2DLvhj3aZBRo+IDq3wpxVuC9wZwfpu0K6gIUsE6m8vhhwuqDMFdPgmwZEav3rNXX03FZNw0kypRBG0=");

        $this->success('成功',$token);
    }
}
